Dynomotion

Group: DynoMotion Message: 3737 From: quelisto Date: 2/6/2012
Subject: Servoing with user defined input
Tom: is it possible to run closed loop with user defined input? If so, what is to be done? Am I to run a separate thread that will translate the inputs (such as the 3 Halls, for example) into the logic output of a quadrature encoder (in other words, a table lookup)? If so, what are the C functions to be used to send this logic output to the error summation part of the firmware?

Thanks.

-Erik-
Group: DynoMotion Message: 3739 From: Tom Kerekes Date: 2/6/2012
Subject: Re: Servoing with user defined input
Hi Erik,
 
Yes you will need to run a User Program to compute the actual position yourself.  You will compute the Position.  It needs to be in the form of a floating point position (not quadrature logic).  You will need to handle the Hall State wraparound situation in your program.  The system will then treat that Position as any other input type such as an from an Encoder or ADC and internally compute error by comparing it to the trajectory.  Set the Input Mode to User Input and in your program set the position as:
 
ch0->Position = EriksPosition;
 
Regards
TK

Group: DynoMotion Message: 3749 From: quelisto Date: 2/6/2012
Subject: Re: Servoing with user defined input
Tom: thanks for the reply. Just to confirm my understanding, what I am to do in the C program is to compute the position from my user defined input and place the resultant in the .position member of the "chan" struct. The fact that I've selected user input mode is alerting your firmware that I am closing the loop, and that it is to look for the resultant in the chan struct in order to compute error. Furthermore, I assume that I will have to keep track of cumulative/absolute position; Halls changing state will be used to increment/decrement the position (in other words, the position is NOT limited to 0 to 2Pi). Finally, if I'm using user input, am I correct to presume the inv_dist_per_cycle, input_gain and other encoder parameters would be ignored in the error calculation?

I'd like to take this one step further: is it possible to do velocity control by calculating velocity and placing the resultant in chan.velocity? Also, would I need to be doing this anyway for the "inner" servo loop, or is it differentiating the position data on its own?

Thanks.

-Erik-



--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> Yes you will need to run a User Program to compute the actual position yourself.  You will compute the Position.  It needs to be in the form of a floating point position (not quadrature logic).  You will need to handle the Hall State wraparound situation in your program.  The system will then treat that Position as any other input type such as an from an Encoder or ADC and internally compute error by comparing it to the trajectory.  Set the Input Mode to User Input and in your program set the position as:
>  
> ch0->Position = EriksPosition;
>  
> Regards
> TK
>
>
> ________________________________
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, February 6, 2012 7:38 AM
> Subject: [DynoMotion] Servoing with user defined input
>
>
>  
> Tom: is it possible to run closed loop with user defined input? If so, what is to be done? Am I to run a separate thread that will translate the inputs (such as the 3 Halls, for example) into the logic output of a quadrature encoder (in other words, a table lookup)? If so, what are the C functions to be used to send this logic output to the error summation part of the firmware?
>
> Thanks.
>
> -Erik-
>
Group: DynoMotion Message: 3751 From: Tom Kerekes Date: 2/6/2012
Subject: Re: Servoing with user defined input
Hi Erik,
 
Yes everything you said is basically correct but I would use different terminology.  You are not closing the loop.  KFLOP is still closing the loop by computing the error, PID, Filters, etc...  All you are doing is providing the Position Input.
 
You could provide the position as a number 0 to 2 Pi for one cycle, but I think it would be simpler to just provide position as 0 to 5 (6 counts per cycle).  Also note that your motor may have more than one cycle per rev.
 
invDistPerCycle is used to commutate the motor so if there are 6 counts per cycle set this as 1/6th.
 
Yes you shouldn't need to calculate velocity.  Velocity can already be incorporated by using Derivative gain and or Filters.
 
Regards
TK

Group: DynoMotion Message: 3757 From: quelisto Date: 2/6/2012
Subject: Re: Servoing with user defined input
Tom: I'm a little confused now. The chan.position number is to be a modular/incremental number rather than an absolute number? If that's the case, how would I command a move beyond one rotation?

Also, how would velocity control be accomplished? Am I to use the chan.velocity parameter?

And, what does inv_dist_per_cycle stand for?

Thanks.

-Erik-

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> Yes everything you said is basically correct but I would use different terminology.  You are not closing the loop.  KFLOP is still closing the loop by computing the error, PID, Filters, etc...  All you are doing is providing the Position Input.
>  
> You could provide the position as a number 0 to 2 Pi for one cycle, but I think it would be simpler to just provide position as 0 to 5 (6 counts per cycle).  Also note that your motor may have more than one cycle per rev.
>  
> invDistPerCycle is used to commutate the motor so if there are 6 counts per cycle set this as 1/6th.
>  
> Yes you shouldn't need to calculate velocity.  Velocity can already be incorporated by using Derivative gain and or Filters.
>  
> Regards
> TK
>
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, February 6, 2012 5:16 PM
> Subject: [DynoMotion] Re: Servoing with user defined input
>
>
>  
> Tom: thanks for the reply. Just to confirm my understanding, what I am to do in the C program is to compute the position from my user defined input and place the resultant in the .position member of the "chan" struct. The fact that I've selected user input mode is alerting your firmware that I am closing the loop, and that it is to look for the resultant in the chan struct in order to compute error. Furthermore, I assume that I will have to keep track of cumulative/absolute position; Halls changing state will be used to increment/decrement the position (in other words, the position is NOT limited to 0 to 2Pi). Finally, if I'm using user input, am I correct to presume the inv_dist_per_cycle, input_gain and other encoder parameters would be ignored in the error calculation?
>
> I'd like to take this one step further: is it possible to do velocity control by calculating velocity and placing the resultant in chan.velocity? Also, would I need to be doing this anyway for the "inner" servo loop, or is it differentiating the position data on its own?
>
> Thanks.
>
> -Erik-
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Erik,
> >  
> > Yes you will need to run a User Program to compute the actual position yourself.  You will compute the Position.  It needs to be in the form of a floating point position (not quadrature logic).  You will need to handle the Hall State wraparound situation in your program.  The system will then treat that Position as any other input type such as an from an Encoder or ADC and internally compute error by comparing it to the trajectory.  Set the Input Mode to User Input and in your program set the position as:
> >  
> > ch0->Position = EriksPosition;
> >  
> > Regards
> > TK
> >
> >
> > ________________________________
> > From: quelisto <quelisto@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, February 6, 2012 7:38 AM
> > Subject: [DynoMotion] Servoing with user defined input
> >
> >
> >  
> > Tom: is it possible to run closed loop with user defined input? If so, what is to be done? Am I to run a separate thread that will translate the inputs (such as the 3 Halls, for example) into the logic output of a quadrature encoder (in other words, a table lookup)? If so, what are the C functions to be used to send this logic output to the error summation part of the firmware?
> >
> > Thanks.
> >
> > -Erik-
> >
>
Group: DynoMotion Message: 3760 From: Tom Kerekes Date: 2/6/2012
Subject: Re: Servoing with user defined input
Hi Erik,
 
No, chan[xx].Position is an absolute number.
 
So for example if the decode of the hall sensors went:
 
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2
 
You would set the position to
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
 
To control velocity the simplest thing would be to Jog at a constant velocity.
 
Jog(0,1000);
 
The chan[xx].Vel set the max velocity allowed on a point to point move
 
The InvDistPerCyle stands for Inverse Distance Per Cycle.  It is set as an inverse so the DSP can easily use it by doing a multiplication rather than a division (which isn't supported in hardware).   It is normally used in conjunction with the current position to do the sinusoidal commutation.  But in your case since the position will change in big jumps the result will not be sinusoidal.
 
Regards
TK